package lesson;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;

import java.io.IOException;

public class TestJsoup {
    public static void main(String[] args) throws IOException {
        Document document = Jsoup.connect("http://127.0.0.1:8848/jsoup/jsoup-test.html").get();
        String title = document.title();
        //获取职位信息
        Elements allJobName = document.getElementsByClass("job-name");
        Elements allJobAddress = document.getElementsByClass("job-address");
        //遍历职位与地址信息
        for(int i = 0; i < allJobName.size()&& i < allJobAddress.size(); i++){
            String jobName = allJobName.get(i).text();
            String jobAddress = allJobAddress.get(i).text();
            System.out.println(jobName+":"+jobAddress);
        }

        System.out.println(title);
    }
}
